
import 'package:flutter/material.dart';

import 'FirstPage.dart';
import 'FourtPage.dart';
import 'SecondPage.dart';
import 'ThridPage.dart';

class Home1 extends StatefulWidget {
  Home1({Key key}) : super(key: key);

  @override
  _Home1State createState() => _Home1State();
}

class _Home1State extends State<Home1> with SingleTickerProviderStateMixin{

   List<Tab> _tabs = [
    Tab(text:"步行"),
    Tab(text:'呼啦圈'),
    Tab(text:'臂力棒'),
    Tab(text:'跳绳'),

  ];

   final List<Widget> _pages = [
    FirthPage(),
    SecondPage(),
    ThridPage(),
    FourthPage(),

  ];

  TabController _controller;
  @override
  void initState() {
    
    super.initState();
    _controller = TabController(length: _tabs.length, vsync: this);

  }
  @override
  Widget build(BuildContext context) {
    return Scaffold(
       appBar: AppBar(
          title:Text("为己无止境"),
          bottom: TabBar(
            controller: _controller,
            tabs: _tabs,
          ),
        ),
        body: _buildBody(),
    );
  }

  Widget _buildBody() {
    return TabBarView(
      controller: _controller,
      children: _pages,
    );
  }
}



